<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>用户添加</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <meta name="csrf-token" content="{{csrf_token()}}">
        @include('home.public.style')
        @include('home.public.script')
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form" method="post" action="{{url('home/order/doaddorder')}}">
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>账户名
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="username" name="chargeaccount" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="tel" class="layui-form-label">
                            <span class="x-red">*</span>金额
                        </label>
                        <div class="layui-input-inline">
                            <input type="tel" id="tel" name="price" required="" lay-verify="tel"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="L_pass" class="layui-form-label">
                            IP地址
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="L_pass" name="ip" required="" lay-verify="pass"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="L_repass" class="layui-form-label"></label>
                        <button class="layui-btn" lay-filter="add" lay-submit="">增加</button>
                    </div>
                </form>
            </div>
        </div>
        <script>layui.use(['form', 'layer','jquery'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;

                //监听提交
                form.on('submit(add)',
                function(data) {
                    //发异步，把数据提交给php
                    $.ajax({
                        type:"post",
                        url:"/home/order/doaddorder",
                        dateType:'json',
                        headers:{
                            "X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr('content')
                        },
                        data:data.field,
                        success:function(data){
                            // console.log(data)
                            layer.msg("增加成功", {
                                icon: 6,
                                time:400
                            },
                            function() {
                                //关闭当前frame
                                xadmin.close();

                                // 可以对父窗口进行刷新
                                xadmin.father_reload();
                            });
                        },
                        error:function(){
                            layer.alert("增加失败", {
                                icon: 5
                            },
                            function() {
                                //关闭当前frame
                                xadmin.close();
                            });
                        }
                    })



                    return false;
                });

            });</script>
    </body>

</html>